#!/usr/local/bin/lua
local t = {}

if arg[1] == nil or arg[2] == nil or arg[3] == nil
then
    print("Usage: " .. arg[0] .. " year month day [N]")
    return
end

t.year = arg[1]
t.month = arg[2]
t.day = arg[3]
t.hour = 0

if arg[4] == nil
then
    day = math.floor((os.time() - os.time(t))/86400)
    print("since "..t.year.."-"..t.month.."-"..t.day.." pass "..day.." days")
else
    date = os.date("%Y-%m-%d", os.time(t)+arg[4]*86400)
    print(arg[4] .. " days from now is " .. date)
end
